﻿@model EditorialProyectos.Website.Models.CategoryViewModel
@{
    ViewBag.Title = "Main";
    if (User.IsInRole("Admin"))
    {
        Layout = "~/Views/Shared/_AdminLayout.cshtml";
    }
    else
    {
        Layout = "~/Views/Shared/_UserLayout.cshtml";
    }
}

@section Scripts{
    @Content.ViewModel("ListViewModel.js", Url)
    @Content.ViewModel("CategoryViewModel.js", Url)
    @Html.KOGridTemplate(model => model.List)

    <script>
        var modelData = '@Html.Raw(Model.ToJson())';
        var modelJSON = JSON.parse(modelData);

        var viewModel = new CategoryViewModel(modelJSON);
        ko.applyBindings(viewModel);
    </script>
}

<div class="jumbotron color-white" data-bind="with: viewModel">
    @Html.Partial("MainPartial", Model)
</div>
